//
//  ZYXMyHeaderView.m
//  RuiBeiKang
//
//  Created by iOS开发1 on 2019/1/4.
//  Copyright © 2019年 JW. All rights reserved.
//

#import "ZYXMyHeaderView.h"

@implementation ZYXMyHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(void)awakeFromNib{
    [super awakeFromNib];
//    self.imgWidth.constant = HEIGHT(20);
}

-(void)setModel:(ZYXMyModel *)model{
    _model = model;
    self.nameLabel.text = model.nickname;
    ///图片地址
    [self.imgIcon sd_setImageWithURL:[NSURL URLWithString:kImgAllUrl(model.avatar)] placeholderImage:IMG(@"touxiang")];
    
    if ([model.is_vip isEqualToString:@"1"]) {
        //是会员
        self.isVipLabel.text = @"知与行VIP";
        self.contentLabel.text = [NSString stringWithFormat:@"到期时间：%@",model.time];;
        [self.payOrVipButton setBackgroundImage:IMG(@"lijixufei") forState:UIControlStateNormal];
    }else{
        //不是会员
        self.isVipLabel.text = @"开通VIP";
        self.contentLabel.text = @"海量课程任你学！";
       [self.payOrVipButton setBackgroundImage:IMG(@"lijikaiting") forState:UIControlStateNormal];
    }
    if ([model.res isEqualToString:@"1"]) {
        //有消息
        [self.msgButton setImage:IMG(@"xiaoxidain") forState:UIControlStateNormal];
    }else{
        //没有消息
        [self.msgButton setImage:IMG(@"xiaoxi") forState:UIControlStateNormal];
    }
}
@end
